﻿<%@ Page Language="vb" AutoEventWireup="false" MasterPageFile="~/Master/InSite.Master" CodeBehind="GroupManager.aspx.vb" Inherits="Core.GroupManager" 
    title="Quản lý nhóm người dùng" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">    
    <fieldset style="width:300px;margin: 0 auto;">
    <table width="100%">
        <tr>
            <td style="width:100px; color: #666666;">
                Tên nhóm:
            </td>
            <td>
                <asp:TextBox ID="txtGroupName" class="mediumfield" runat="server"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td style="width:100px; color: #666666;">
                Trạng thái:
            </td>
            <td>
                <asp:DropDownList ID="cbxStatus" runat="server" CssClass="centerCbx" Width="218px"></asp:DropDownList>
            </td>
        </tr>
        
        <tr>
            <td>
            </td>
            <td>
                <asp:Button ID="btnSearch" runat="server" Text="Tìm kiếm" class="button" Height="26px"/>
                <asp:Button ID="btnNew" runat="server" Text="Thêm mới" class="button" Height="26px" />
            </td>
        </tr>
    </table>
</fieldset>
       
<fieldset>
    <legend>Danh sách nhóm</legend>
    <asp:SqlDataSource ID="dsSource" runat="server"></asp:SqlDataSource>
    <asp:SqlDataSource ID="dsStt" runat="server"></asp:SqlDataSource>
    <asp:GridView ID="gridMenu" runat="server" DataSourceID="dsSource" class="tblMain" 
            AutoGenerateColumns="False" GridLines="None" AllowPaging="True" 
            PageSize="10" AllowSorting="True" BorderStyle="None" DataKeyNames="GroupID" HeaderStyle-BackColor="#9097a9">
        <Columns>
                <asp:TemplateField HeaderText="No.">
                    <ItemTemplate>
                        <asp:Label Visible="false" runat="server" ID="lbl_ID" Text='<%#Eval("GroupID") %>'></asp:Label>
                        <asp:Label runat="server" ID="lblSTT" Text='<%#Container.DataItemIndex + 1 %>'></asp:Label>
                    </ItemTemplate>
                    <HeaderStyle Width="50px" HorizontalAlign="Left" />
                    <ItemStyle Width="50px" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Tên nhóm">
                    <ItemStyle Width="200px" />
                    <ItemTemplate>
                        <asp:Label runat="server" ID="lbl_GroupName" Text='<%#Eval("GroupName") %>'></asp:Label>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:TextBox runat="server" ID="txtGroupName" Text='<%#Eval("GroupName") %>'></asp:TextBox>
                    </EditItemTemplate>
                    <HeaderStyle HorizontalAlign="Left" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Trạng thái">
                    <ItemTemplate>
                        <asp:Label ID="lbGroupName" runat="server" Text='<%#getColorStt(Eval("GroupStt")) %>'></asp:Label>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:DropDownList ID="ddlStt"
                         DataSourceID="dsStt" DataTextField="CodeDesc"  DataValueField="CodeValue"
                        SelectedValue='<%# Bind("GroupStt") %>' runat="server">
                        </asp:DropDownList>
                    </EditItemTemplate>
                    <HeaderStyle Width="150px" HorizontalAlign="Left" />
                    <ItemStyle Width="150px" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Update" ShowHeader="False" HeaderStyle-HorizontalAlign="Left" ItemStyle-Width="100"> 
                    <EditItemTemplate> 
                        <asp:ImageButton ID="ImageButton1" runat="server" CausesValidation="True" CommandName="Update" ImageUrl="~/static/inSite/images/save.png" CssClass="noneCSS"/>
                        <asp:ImageButton ID="ImageButton2" runat="server" CausesValidation="False" CommandName="Cancel" ImageUrl="~/static/inSite/images/stop.png" CssClass="noneCSS"/>
                    </EditItemTemplate> 
                    <ItemTemplate> 
                        <asp:ImageButton ID="ImageButton1" runat="server" CausesValidation="False" CommandName="Edit" ImageUrl="~/static/inSite/images/edit.png" CssClass="noneCSS"/>
                    </ItemTemplate> 
                    <HeaderStyle HorizontalAlign="Left"></HeaderStyle>
                    <ItemStyle Width="50px"></ItemStyle>
                </asp:TemplateField> 
                <asp:TemplateField HeaderText="Xóa" ShowHeader="False" HeaderStyle-HorizontalAlign="Left" ItemStyle-Width="100"> 
                    <ItemTemplate> 
                        <asp:ImageButton ID="butDelete" runat="server" CausesValidation="False" CommandName="Delete" ImageUrl="~/static/inSite/images/recycle.png" CssClass="noneCSS" OnClientClick="return confirm('Bạn có chắc chắn muốn xóa <Nhóm Người Dùng> này? \n\nChú ý: Toàn bộ <Người Dùng> thuộc Nhóm này cũng sẽ bị xóa theo.');"/>
                    </ItemTemplate> 
                    <HeaderStyle HorizontalAlign="Left"></HeaderStyle>
                    <ItemStyle Width="50px"></ItemStyle>
                </asp:TemplateField> 
                <asp:TemplateField HeaderText="Phân quyền">
                    <ItemTemplate>
                        <asp:Label ID="lbPms" runat="server" Text='<%#getPmsLink(Eval("GroupID")) %>'></asp:Label>
                    </ItemTemplate>
                    <HeaderStyle Width="50px" HorizontalAlign="Left" />
                    <ItemStyle Width="50px" />
                </asp:TemplateField>
            </Columns>
        <PagerStyle HorizontalAlign="Center" />
    </asp:GridView>
    </fieldset>
</asp:Content>
